<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<style>
    ul.ztree {
        border: 1px solid #ccc;
        background-color: #fff;
        height: 200px;
        overflow-y: scroll;
        overflow-x: auto;
    }
</style>
<!-- Content Header (Page header) -->
<section class="content-header" style="">
    <h1>
        商户管理
        <small>机器信息管理页面</small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> 主页</a></li>
        <li><a href="#">商户管理</a></li>
        <li class="active">机器信息管理页面</li>
    </ol>
</section>

<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <!-- /.box-header -->
                <div class="box-body">
                    <div id="toolbar">
                        <form class="form-inline" id="searchForm">
                            <div class="form-group">
                                <label for="searchMachNo">机器号</label>
                                <input type="text" class="form-control input-sm" name="machNo" id="searchMachNo" placeholder="请输入机器号">
                            </div>
                            <div class="btn-group">
                                <button type="button" class="btn btn-default btn-sm" onclick="javascript:$('table').bootstrapTable('refresh', {silent: true});">
                                    <i class="glyphicon glyphicon-search"></i>
                                    查询
                                </button>
                                <button type="reset" class="btn btn-default btn-sm">
                                    <i class="glyphicon glyphicon-trash"></i>
                                    清空
                                </button>
                            </div>
                        </form>
                        <div class="btn-group btn-group-sm">
                            <!-- Provides extra visual weight and identifies the primary action in a set of buttons -->
                            <button shiro:hasPermission="machinfo:create" type="button" id="addBtn" class="btn btn-default" data-toggle="modal"
                                    data-target="#addModal" data-action="{before:'addBefore'}"><i class="glyphicon glyphicon glyphicon-plus"></i> 新增
                            </button>
                            <!-- Indicates caution should be taken with this action -->
                            <button shiro:hasPermission="machinfo:update" type="button" id="editBtn" class="btn btn-default" data-toggle="modal"
                                    data-target="#editModal"
                                    data-action="{type:'editable',form:'#editForm',table:'#table',after:'editAfter'}"
                                    disabled><i class="glyphicon glyphicon glyphicon-edit"></i> 修改
                            </button>
                            <!-- Indicates a dangerous or potentially negative action -->
                            <button shiro:hasPermission="machinfo:delete" type="button" id="deleteBtn" class="btn btn-default" data-toggle="modal"
                                    data-target="#deleteModal"
                                    data-action="{type:'delete',form:'#deleteForm',idField:'id',table:'#table'}" disabled><i
                                    class="glyphicon glyphicon-remove"></i> 删除
                            </button>
                        </div>
                    </div>
                    <table id="table"></table>
                </div>
                <!-- /.box-body -->
            </div>
            <!-- /.box -->

        </div>
        <!-- /.col -->
    </div>
    <!-- /.row -->
</section>
<!-- /.content -->

<!-- add Modal -->
<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="addModalLabel">添加机器信息</h4>
            </div>
            <div class="modal-body">
                <form id="addForm">
                    <div class="form-group">
                        <label class="control-label" for="machNo">机器号:</label>
                        <input id="machNo" type="text" class="form-control" name="machNo" placeholder="输入机器号">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="organizationId"><span class="asterisk">*</span>公司:</label>
                        <select name="organizationId" id="organizationId" class="form-control"
                                data-placeholder="请从列表选择一项" required>
                            <option value="">请选择公司</option>
                            <option th:each="list : ${lists}" th:value="${list.id}" th:text="${list.name}">
                                公司不存在
                            </option>
                        </select>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="machNo">机器名称:</label>
                        <input id="machName" type="text" class="form-control" name="machName" placeholder="输入机器名称">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="machXfType"><span class="asterisk">*</span>消费机类型:</label>
                        <select name="machXfType" id="machXfType" class="form-control"
                                data-placeholder="请从列表选择一项" required>
                            <option value="">请选择消费机类型</option>
                            <option th:each="machxftype : ${machXFType}" th:value="${machxftype.id}" th:text="${machxftype.name}">
                                消费机类型不存在
                            </option>
                        </select>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="machType"><span class="asterisk">*</span>机器类型:</label>
                        <select name="machType" id="machType" class="form-control"
                                data-placeholder="请从列表选择一项" required>
                            <option value="">请选择机器类型</option>
                            <option th:each="machtype : ${machType}" th:value="${machtype.id}" th:text="${machtype.name}">
                                机器类型不存在
                            </option>
                        </select>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="placeid">收费点ID:</label>
                        <input id="placeid" type="text" class="form-control" name="placeid" placeholder="输入收费点ID">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="unitid">业主ID:</label>
                        <input id="unitid" type="text" class="form-control" name="unitid" placeholder="输入业主ID">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="cashierno">收款员:</label>
                        <input id="cashierno" type="text" class="form-control" name="cashierno" placeholder="输入收款员">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="cardTypeId">绑定的卡类型:</label>
                        <input id="cardTypeId" type="text" class="form-control" name="cardTypeId" placeholder="输入绑定的卡类型">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="maxOneXf">单笔最大消费金额:</label>
                        <input id="maxOneXf" type="text" class="form-control" name="maxOneXf" placeholder="输入单笔最大消费金额" oninput="num(this)">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="zaoMoney">早餐消费金额:</label>
                        <input id="zaoMoney" type="text" class="form-control" name="zaoMoney" placeholder="输入早餐消费金额" oninput="num(this)">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="zhongMoney">中餐消费金额:</label>
                        <input id="zhongMoney" type="text" class="form-control" name="zhongMoney" placeholder="输入中餐消费金额" oninput="num(this)">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="wanMoney">晚餐消费金额:</label>
                        <input id="wanMoney" type="text" class="form-control" name="wanMoney" placeholder="输入晚餐消费金额" oninput="num(this)">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="yeMoney">夜宵消费金额:</label>
                        <input id="yeMoney" type="text" class="form-control" name="yeMoney" placeholder="输入夜宵消费金额" oninput="num(this)">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="xiaoMoney">宵夜消费金额:</label>
                        <input id="xiaoMoney" type="text" class="form-control" name="xiaoMoney" placeholder="输入宵夜消费金额" oninput="num(this)">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="strDateTime">添加时间:</label>
                        <input id="strDateTime" type="text" class="form-control" name="strDateTime">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" >是否删除:</label>
                        是<input type="radio"  name="delYn" id="every" value="1">
                        否<input type="radio" name="delYn" id="every1" value="0" checked>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="ipAddress">机器通讯IP地址:</label>
                        <input id="ipAddress" type="text" class="form-control" name="ipAddress" placeholder="输入机器通讯IP地址">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="strLastcommtime">机器最新通讯时间:</label>
                        <input id="strLastcommtime" type="text" class="form-control" name="strLastcommtime">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" >是否启用:</label>
                        是<input type="radio"  name="isState" id="state" value="1">
                        否<input type="radio" name="isState" id="state1" value="0" checked>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="maxamount">消费机器充值模式下最大充值金额:</label>
                        <input id="maxamount" type="text" class="form-control" name="maxamount" placeholder="输入消费机器充值模式下最大充值金额" oninput="num(this)">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="sumamount">统计该机器已充值的总金额:</label>
                        <input id="sumamount" type="text" class="form-control" name="sumamount" placeholder="输入统计该机器已充值的总金额" oninput="num(this)">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" >通讯是否下传设备参数:</label>
                        下传完成<input type="radio"  name="upstate" id="upstate" value="1">
                        下传<input type="radio" name="upstate" id="upstate1" value="0" checked>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="OffLineSum">离线最大记录数量:</label>
                        <input id="OffLineSum" type="text" class="form-control" name="OffLineSum" placeholder="输入离线最大记录数量">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="OffLineDay">离线最大天数:</label>
                        <input id="OffLineDay" type="text" class="form-control" name="OffLineDay" placeholder="输入离线最大天数">
                        <div class="help-block with-errors"></div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="submit" form="addForm" class="btn btn-primary"
                        data-action="{type:'submit',form:'#addForm',url:'@{/machinfo/add}',after:'$.myAction.refreshTable'}">
                    确定
                </button>
            </div>
        </div>
    </div>
</div>
<!-- edit Modal -->
<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="editModalLabel">修改角色</h4>
            </div>
            <div class="modal-body">
                <form id="editForm">
                    <input type="hidden" name="id"/>
                    <div class="form-group">
                        <label class="control-label" for="editmachNo">机器号:</label>
                        <input id="editmachNo" type="text" class="form-control" name="machNo" placeholder="输入机器号">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="editorganizationId"><span class="asterisk">*</span>公司:</label>
                        <select name="organizationId" id="editorganizationId" class="form-control"
                                data-placeholder="请从列表选择一项" required>
                            <option value="">请选择公司</option>
                            <option th:each="list : ${lists}" th:value="${list.id}" th:text="${list.name}">
                                公司不存在
                            </option>
                        </select>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="editmachName">机器名称:</label>
                        <input id="editmachName" type="text" class="form-control" name="machName" placeholder="输入机器名称">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="editmachXfType"><span class="asterisk">*</span>消费机类型:</label>
                        <select name="machXfType" id="editmachXfType" class="form-control"
                                data-placeholder="请从列表选择一项" required>
                            <option value="">请选择消费机类型</option>
                            <option th:each="machxftype : ${machXFType}" th:value="${machxftype.id}" th:text="${machxftype.name}">
                                消费机类型不存在
                            </option>
                        </select>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="editmachType"><span class="asterisk">*</span>机器类型:</label>
                        <select name="machType" id="editmachType" class="form-control"
                                data-placeholder="请从列表选择一项" required>
                            <option value="">请选择机器类型</option>
                            <option th:each="machtype : ${machType}" th:value="${machtype.id}" th:text="${machtype.name}">
                                机器类型不存在
                            </option>
                        </select>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="editplaceid">收费点ID:</label>
                        <input id="editplaceid" type="text" class="form-control" name="placeid" placeholder="输入收费点ID">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="editunitid">业主ID:</label>
                        <input id="editunitid" type="text" class="form-control" name="unitid" placeholder="输入业主ID">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="editcashierno">收款员:</label>
                        <input id="editcashierno" type="text" class="form-control" name="cashierno" placeholder="输入收款员">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="editcardTypeId">绑定的卡类型:</label>
                        <input id="editcardTypeId" type="text" class="form-control" name="cardTypeId" placeholder="输入绑定的卡类型">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="editmaxOneXf">单笔最大消费金额:</label>
                        <input id="editmaxOneXf" type="text" class="form-control" name="maxOneXf" placeholder="输入单笔最大消费金额" oninput="num(this)">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="editzaoMoney">早餐消费金额:</label>
                        <input id="editzaoMoney" type="text" class="form-control" name="zaoMoney" placeholder="输入早餐消费金额" oninput="num(this)">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="editzhongMoney">中餐消费金额:</label>
                        <input id="editzhongMoney" type="text" class="form-control" name="zhongMoney" placeholder="输入中餐消费金额" oninput="num(this)">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="editwanMoney">晚餐消费金额:</label>
                        <input id="editwanMoney" type="text" class="form-control" name="wanMoney" placeholder="输入晚餐消费金额" oninput="num(this)">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="edityeMoney">夜宵消费金额:</label>
                        <input id="edityeMoney" type="text" class="form-control" name="yeMoney" placeholder="输入夜宵消费金额" oninput="num(this)">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="editxiaoMoney">宵夜消费金额:</label>
                        <input id="editxiaoMoney" type="text" class="form-control" name="xiaoMoney" placeholder="输入宵夜消费金额" oninput="num(this)">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="editstrDateTime">添加时间:</label>
                        <input id="editstrDateTime" type="text" class="form-control" name="strDateTime">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" >是否删除:</label>
                        是<input type="radio"  name="delYn" id="editevery" value="1">
                        否<input type="radio" name="delYn" id="editevery1" value="0">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="editipAddress">机器通讯IP地址:</label>
                        <input id="editipAddress" type="text" class="form-control" name="ipAddress" placeholder="输入机器通讯IP地址">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="editstrLastcommtime">机器最新通讯时间:</label>
                        <input id="editstrLastcommtime" type="text" class="form-control" name="strLastcommtime">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" >是否启用:</label>
                        是<input type="radio"  name="isState" id="editstate" value="1">
                        否<input type="radio" name="isState" id="editstate1" value="0">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="editmaxamount">消费机器充值模式下最大充值金额:</label>
                        <input id="editmaxamount" type="text" class="form-control" name="maxamount" placeholder="输入消费机器充值模式下最大充值金额" oninput="num(this)">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="editsumamount">统计该机器已充值的总金额:</label>
                        <input id="editsumamount" type="text" class="form-control" name="sumamount" placeholder="输入统计该机器已充值的总金额" oninput="num(this)">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" >通讯是否下传设备参数:</label>
                        下传完成<input type="radio"  name="upstate" id="editupstate" value="1">
                        下传<input type="radio" name="upstate" id="editupstate1" value="0">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="editOffLineSum">离线最大记录数量:</label>
                        <input id="editOffLineSum" type="text" class="form-control" name="OffLineSum" placeholder="输入离线最大记录数量">
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="editOffLineDay">离线最大天数:</label>
                        <input id="editOffLineDay" type="text" class="form-control" name="OffLineDay" placeholder="输入离线最大天数">
                        <div class="help-block with-errors"></div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="submit" form="editForm" class="btn btn-primary"
                        data-action="{type:'submit',form:'#editForm',url:'@{/machinfo/update}',after:'$.myAction.refreshTable'}">
                    确定
                </button>
            </div>
        </div>
    </div>
</div>

<!-- details Modal -->
<div class="modal fade" id="detailsModal" tabindex="-1" role="dialog" aria-labelledby="detailsModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="detailsodalLabel">修改角色</h4>
            </div>
            <div class="modal-body">
                <form id="detailsForm">
                    <input type="hidden" name="id"/>
                    <div class="form-group">
                        <label class="control-label" for="detailsmachNo">机器号:</label>
                        <input id="detailsmachNo" type="text" class="form-control" name="machNo" placeholder="输入机器号" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="detailsorganizationId"><span class="asterisk">*</span>公司:</label>
                        <select name="organizationId" id="detailsorganizationId" class="form-control"
                                data-placeholder="请从列表选择一项" required disabled>
                            <option value="">请选择公司</option>
                            <option th:each="list : ${lists}" th:value="${list.id}" th:text="${list.name}">
                                公司不存在
                            </option>
                        </select>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="detailsmachName">机器名称:</label>
                        <input id="detailsmachName" type="text" class="form-control" name="machName" placeholder="输入机器名称" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="detailsmachXfType"><span class="asterisk">*</span>消费机类型:</label>
                        <select name="machXfType" id="detailsmachXfType" class="form-control"
                                data-placeholder="请从列表选择一项" disabled>
                            <option value="">请选择消费机类型</option>
                            <option th:each="machxftype : ${machXFType}" th:value="${machxftype.id}" th:text="${machxftype.name}">
                                消费机类型不存在
                            </option>
                        </select>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="detailsmachType"><span class="asterisk">*</span>机器类型:</label>
                        <select name="machType" id="detailsmachType" class="form-control"
                                data-placeholder="请从列表选择一项" disabled>
                            <option value="">请选择机器类型</option>
                            <option th:each="machtype : ${machType}" th:value="${machtype.id}" th:text="${machtype.name}">
                                机器类型不存在
                            </option>
                        </select>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="detailsplaceid">收费点ID:</label>
                        <input id="detailsplaceid" type="text" class="form-control" name="placeid" placeholder="输入收费点ID" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="detailsunitid">业主ID:</label>
                        <input id="detailsunitid" type="text" class="form-control" name="unitid" placeholder="输入业主ID" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="detailscashierno">收款员:</label>
                        <input id="detailscashierno" type="text" class="form-control" name="cashierno" placeholder="输入收款员" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="detailscardTypeId">绑定的卡类型:</label>
                        <input id="detailscardTypeId" type="text" class="form-control" name="cardTypeId" placeholder="输入绑定的卡类型" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="detailsmaxOneXf">单笔最大消费金额:</label>
                        <input id="detailsmaxOneXf" type="text" class="form-control" name="maxOneXf" placeholder="输入单笔最大消费金额" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="detailszaoMoney">早餐消费金额:</label>
                        <input id="detailszaoMoney" type="text" class="form-control" name="zaoMoney" placeholder="输入早餐消费金额" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="detailszhongMoney">中餐消费金额:</label>
                        <input id="detailszhongMoney" type="text" class="form-control" name="zhongMoney" placeholder="输入中餐消费金额" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="detailswanMoney">晚餐消费金额:</label>
                        <input id="detailswanMoney" type="text" class="form-control" name="wanMoney" placeholder="输入晚餐消费金额" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="detailsyeMoney">夜宵消费金额:</label>
                        <input id="detailsyeMoney" type="text" class="form-control" name="yeMoney" placeholder="输入夜宵消费金额" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="detailsxiaoMoney">宵夜消费金额:</label>
                        <input id="detailsxiaoMoney" type="text" class="form-control" name="xiaoMoney" placeholder="输入宵夜消费金额" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="detailsstrDateTime">添加时间:</label>
                        <input id="detailsstrDateTime" type="text" class="form-control" name="strDateTime" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" >是否删除:</label>
                        是<input type="radio"  name="delYn" id="detailsevery" value="1" disabled>
                        否<input type="radio" name="delYn" id="detailsevery1" value="0" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="detailsipAddress">机器通讯IP地址:</label>
                        <input id="detailsipAddress" type="text" class="form-control" name="ipAddress" placeholder="输入机器通讯IP地址" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="detailsstrLastcommtime">机器最新通讯时间:</label>
                        <input id="detailsstrLastcommtime" type="text" class="form-control" name="strLastcommtime" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" >是否启用:</label>
                        是<input type="radio"  name="isState" id="detailsstate" value="1" disabled>
                        否<input type="radio" name="isState" id="detailsstate1" value="0" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="detailsmaxamount">消费机器充值模式下最大充值金额:</label>
                        <input id="detailsmaxamount" type="text" class="form-control" name="maxamount" placeholder="输入消费机器充值模式下最大充值金额" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="detailssumamount">统计该机器已充值的总金额:</label>
                        <input id="detailssumamount" type="text" class="form-control" name="sumamount" placeholder="输入统计该机器已充值的总金额" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" >通讯是否下传设备参数:</label>
                        下传完成<input type="radio"  name="upstate" id="detailsupstate" value="1" disabled>
                        下传<input type="radio" name="upstate" id="detailsupstate1" value="0" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="detailsOffLineSum">离线最大记录数量:</label>
                        <input id="detailsOffLineSum" type="text" class="form-control" name="OffLineSum" placeholder="输入离线最大记录数量" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="detailsOffLineDay">离线最大天数:</label>
                        <input id="detailsOffLineDay" type="text" class="form-control" name="OffLineDay" placeholder="输入离线最大天数" disabled>
                        <div class="help-block with-errors"></div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>

<!-- delete Modal -->
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteSmallModalLabel">
    <div class="modal-dialog modal-sm" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title" id="deleteSmallModalLabel">删除角色</h4>
            </div>
            <div class="modal-body">
                <form id="deleteForm"></form>
                确定要删除选中的 <span class="records"></span> 条记录?
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" form="deleteForm" class="btn btn-primary"
                        data-action="{type:'submit',form:'#deleteForm',url:'@{/machinfo/delete-batch}',after:'$.myAction.refreshTable'}">
                    确定
                </button>
            </div>
        </div>
    </div>
</div>
<div id="actionButtons" class="admin-hide">
    <a class="like" href="javascript:void(0)" data-toggle="tooltip" title="Like"><i class="glyphicon glyphicon-heart"></i></a>　
    <a shiro:hasPermission="machinfo:update" class="edit ml10" href="javascript:void(0)" data-toggle="tooltip" title="编辑"><i class="glyphicon glyphicon-edit"></i></a>　
    <a shiro:hasPermission="machinfo:delete" class="remove ml10" href="javascript:void(0)" data-toggle="tooltip" title="删除"><i class="glyphicon glyphicon-remove"></i></a>　
</div>
<!-- zTree -->
<div id="menuContent" class="menuContent" style="display:none;z-index:1989101600;position: absolute;">
    <ul id="tree" class="ztree" style="margin-top:0;"></ul>
</div>
<script th:inline="javascript">

    var $table = $('#table');

    $(function () {

        $('#strLastcommtime').daterangepicker({
            "autoApply": true, //选择日期后自动提交;只有在不显示时间的时候起作用timePicker:false
            singleDatePicker: true, //单日历
            showDropdowns: true, //年月份下拉框
            timePicker: true, //显示时间
            timePicker24Hour: true, //时间制
            timePickerSeconds: true, //时间显示到秒
            startDate: moment().hours(0).minutes(0).seconds(0), //设置开始日期
            "opens": "center",
            showWeekNumbers: true,
            locale: {
                format: "YYYY-MM-DD HH:mm:ss", //设置显示格式
                applyLabel: '确定', //确定按钮文本
                cancelLabel: '取消', //取消按钮文本
                daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
                monthNames: ['一月', '二月', '三月', '四月', '五月', '六月',
                    '七月', '八月', '九月', '十月', '十一月', '十二月'
                ],
                firstDay: 1
            },
        }, function(start) {
            console.log(start.format('YYYY-MM-DD HH:mm:ss'));
        });

        $('#strDateTime').daterangepicker({
            "autoApply": true, //选择日期后自动提交;只有在不显示时间的时候起作用timePicker:false
            singleDatePicker: true, //单日历
            showDropdowns: true, //年月份下拉框
            timePicker: true, //显示时间
            timePicker24Hour: true, //时间制
            timePickerSeconds: true, //时间显示到秒
            startDate: moment().hours(0).minutes(0).seconds(0), //设置开始日期
            "opens": "center",
            showWeekNumbers: true,
            locale: {
                format: "YYYY-MM-DD HH:mm:ss", //设置显示格式
                applyLabel: '确定', //确定按钮文本
                cancelLabel: '取消', //取消按钮文本
                daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
                monthNames: ['一月', '二月', '三月', '四月', '五月', '六月',
                    '七月', '八月', '九月', '十月', '十一月', '十二月'
                ],
                firstDay: 1
            },
        }, function(start) {
            console.log(start.format('YYYY-MM-DD HH:mm:ss'));
        });

        //修改
        $('#editstrLastcommtime').daterangepicker({
            "autoApply": true, //选择日期后自动提交;只有在不显示时间的时候起作用timePicker:false
            singleDatePicker: true, //单日历
            showDropdowns: true, //年月份下拉框
            timePicker: true, //显示时间
            timePicker24Hour: true, //时间制
            timePickerSeconds: true, //时间显示到秒
            startDate: moment().hours(0).minutes(0).seconds(0), //设置开始日期
            "opens": "center",
            showWeekNumbers: true,
            locale: {
                format: "YYYY-MM-DD HH:mm:ss", //设置显示格式
                applyLabel: '确定', //确定按钮文本
                cancelLabel: '取消', //取消按钮文本
                daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
                monthNames: ['一月', '二月', '三月', '四月', '五月', '六月',
                    '七月', '八月', '九月', '十月', '十一月', '十二月'
                ],
                firstDay: 1
            },
        }, function(start) {
            console.log(start.format('YYYY-MM-DD HH:mm:ss'));
        });

        $('#editstrDateTime').daterangepicker({
            "autoApply": true, //选择日期后自动提交;只有在不显示时间的时候起作用timePicker:false
            singleDatePicker: true, //单日历
            showDropdowns: true, //年月份下拉框
            timePicker: true, //显示时间
            timePicker24Hour: true, //时间制
            timePickerSeconds: true, //时间显示到秒
            startDate: moment().hours(0).minutes(0).seconds(0), //设置开始日期
            "opens": "center",
            showWeekNumbers: true,
            locale: {
                format: "YYYY-MM-DD HH:mm:ss", //设置显示格式
                applyLabel: '确定', //确定按钮文本
                cancelLabel: '取消', //取消按钮文本
                daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
                monthNames: ['一月', '二月', '三月', '四月', '五月', '六月',
                    '七月', '八月', '九月', '十月', '十一月', '十二月'
                ],
                firstDay: 1
            },
        }, function(start) {
            console.log(start.format('YYYY-MM-DD HH:mm:ss'));
        });
        // bootstrap table初始化
        // http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/
        $table.bootstrapTable({
            url: CONTEXT_PATH + '/machinfo/selectlist',
            idField: 'id',
            searchOnEnterKey: false,
            columns: [
                {field: 'state', checkbox: true},
                {field: 'id', title: '编号', sortable: true, halign: 'left'},
                {field: 'machNo', title: '机器号', sortable: true, halign: 'left'},
                {field: 'machName', title: '机器名称', sortable: true, halign: 'left'},
                {field: 'machXfType', title: '消费类型', sortable: false, halign: 'left',
                    formatter:function(value,row,index){
                        if (value == "32") { return '<div>' + '发卡机' + '</div>'; }
                        else if (value == "21") { return '<div >' + '消费机' + '</div>';  }
                        else if (value == "33") { return '<div >' + '控卡机' + '</div>';  }
                        else if (value == "22") { return '<div >' + '退款机' + '</div>';  }
                        else if (value == "29") { return '<div >' + '水控转款机' + '</div>';  }
                    }},
                {field: 'machType', title: '机器类型', sortable: false, halign: 'left',
                    formatter:function(value,row,index){
                        if (value == "0") { return '<div >' + '消费机' + '</div>'; }
                        else { return '<div >' + '考勤机' + '</div>';  }

                    }},
                {field: 'lastcommtime', title: '机器最新通讯时间', sortable: false, halign: 'left'},
                {field: 'isState', title: '是否启用', sortable: false, halign: 'left',
                    formatter:function(value,row,index){
                        if (value == "0") {
                            return '<div >' + '否' + '</div>';
                        }
                        else { return '<div >' + '是' + '</div>';  }

                    }},
                {
                    field: 'action',
                    title: '操作',
                    halign: 'center',
                    align: 'center',
                    formatter: 'actionFormatter',
                    events: 'actionEvents',
                    clickToSelect: false
                }
            ]
        });
    });

    // 数据表格展开内容
    function detailFormatter(index, row) {
        var html = [];
        $.each(row, function (key, value) {
            html.push('<p><b>' + key + ':</b> ' + value + '</p>');
        });
        return html.join('');
    }


    function actionFormatter(value, row, index) {
        return $('#actionButtons').html();
    }

    window.actionEvents = {
        'click .like': function (e, value, row, index) {
            detailsAfter("",row);
            $('#detailsModal').modal('show');
            $('#detailsForm').fillForm(row);
            console.log(value, row, index);
        },
        'click .edit': function (e, value, row, index) {
            $('#editModal').modal('show')
            $('#editForm').fillForm(row);
            editAfter("",row);
            console.log(value, row, index);
        },
        'click .remove': function (e, value, row, index) {
            $('#deleteModal').modal('show');
            $('.records').html('1');
            var html = '';
            for (var key in row) {
                html += '<input type="hidden" name="' + key + '" value="' + row[key] + '">';
            }
            $('#deleteForm').html(html);
        }
    };

    function detailsAfter(obj, row) {
        $('#detailsForm [name="strLastcommtime"]').val(row.lastcommtime);
        $('#detailsForm [name="strDateTime"]').val(row.dateTime);
    }

    function editAfter(obj, row) {
        $('#editForm [name="strLastcommtime"]').val(row.lastcommtime);
        $('#editForm [name="strDateTime"]').val(row.dateTime);
    }

    //限制只能输入数字和两位小数，用于金额文本框
    function num(obj){
        obj.value = obj.value.replace(/[^\d.]/g,""); //清除"数字"和"."以外的字符
        obj.value = obj.value.replace(/^\./g,""); //验证第一个字符是数字
        obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个, 清除多余的
        obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
        obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3'); //只能输入两个小数
    }
</script>
</html>